#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableAutoChessHeroDao:DaoBase<TableAutoChessHero>
    {
        public override string GetFileName()
        {
            return "TableAutoChessHero.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableAutoChessHero>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableAutoChessHero model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.heroId)) UnityEngine.Debug.LogError("数据表id重复:TableAutoChessHero->id: " + model.heroId);
            #endif
            cachePrimaryInt[model.heroId] = model;
        }
        protected override TableAutoChessHero ParseRowData(string[] rowData)
        {
            TableAutoChessHero data = new TableAutoChessHero();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.heroId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.rare = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.acHeroGroups = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.shopModelScale = double.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.shopModelRote = double.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.ShopOffsetX = double.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.ShopOffsetY = double.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.ShopOffsetZ = double.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.fieldModelScale = double.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.chessId = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.heroStyle = rowData[10];
            }
            return data;
        }
    }
}
